/*
Plugin State
@autor : Javier Camelis
*/
(function($){
  $.widget("ui.state", {
//default options
    options: {
      msg : {
    	  error : "Ocurrio un error.",
    	  loading : " Loading " 
      },
      time : 500
    },
    _init: function(o) {
        //creation code for mywidget
      var self = this, e = this.element ,o = this.options ;
      this.element.hide();
    },
    show : function(msg){
    	var self = this ;
    	this._clear() ;
    	this.element.html(msg)
    	.fadeIn('fast');
    },
    hide : function (){
    	this.element.fadeOut('slow');
    },
    error : function () {
    	this.ui({type : 'error' , icon : 'error' , msg : this.options.msg.error });
    },
    ui : function (opt){
    	var type = opt.type || 'icon' ,icon = opt.icon || '' , msg = opt.msg || '' ;
    	this.element.html(msg)
    	.ui_apply(type,'add',icon)
    	.fadeIn('fast');
    },
    _clear : function(){
    	this.element.ui_apply('remove') ;
    }
  })
})(jQuery);